//
//  TT_NavigationViewController.m
//  ZKGX
//
//  Created by 王洋 on 2020/3/9.
//  Copyright © 2020 王洋. All rights reserved.
//

#import "TT_NavigationViewController.h"

@interface TT_NavigationViewController ()

@end

@implementation TT_NavigationViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    // 返回按钮一直存在文字
    //self.useSystemBackBarButtonItem = YES;

    [[UINavigationBar appearance] setBarTintColor:COLOR_MAIN_FROEGROUND];
    [[UINavigationBar appearance] setTintColor:[UIColor whiteColor]];
    [[UINavigationBar appearance] setTranslucent:NO];
//    [[UINavigationBar appearance] setTitleTextAttributes:
//    @{NSFontAttributeName:[UIFont systemFontOfSize:17],
//    NSForegroundColorAttributeName:[UIColor whiteColor]}];
    
    if (@available(iOS 15.0, *)) {
        UINavigationBarAppearance *appearance = [[UINavigationBarAppearance alloc] init];
        appearance.backgroundEffect = nil;
        appearance.shadowColor = UIColor.clearColor;
        [appearance setBackgroundColor:UIColorHex(0x163a59)];
        [appearance setBackgroundImage:[Utilities imageWithColor:COLOR_MAIN_FROEGROUND]];
        //appearance.titleTextAttributes = @{NSFontAttributeName:[UIFont systemFontOfSize:17.0f weight:UIFontWeightSemibold],NSForegroundColorAttributeName: [UIColor whiteColor]};
        [[UINavigationBar appearance] setScrollEdgeAppearance: appearance];
        [[UINavigationBar appearance] setStandardAppearance:appearance];
    }
    
    [[UITextField appearance] setTintColor:kGreenColor];
    [[UITextView appearance] setTintColor:kGreenColor];
}


- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated {
    if (self.viewControllers.count > 0) {
        viewController.hidesBottomBarWhenPushed = YES;
    }
    [super pushViewController:viewController animated:animated];
}

@end
